import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import {resolve} from "path";

function pathResolve(dir: string) {
    return resolve(process.cwd(), '.', dir)
}

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [vue()],
    base: '/hpc-ui',
    resolve: {
        alias: [
            // /@/xxxx => src/xxxx
            {find: /^~/, replacement: resolve(__dirname, '')},
            {
                find: /\/@\//,
                replacement: pathResolve('src') + '/',
            },
            {
                find: /\/&\//,
                replacement: pathResolve('config') + '/',
            },
        ],
    },
    build: {
        rollupOptions: {
            external: ['fs']
        }
    }
})
